
#include <stdio.h>
#include <stdint.h>
#include <string.h>

#define BIN_FILE_SIZE (8 * 1024 * 1024)

FILE *fout = NULL;
const char *fout_name = "test.bin";
uint8_t buf[256];

int main(void)
{
    fout = fopen(fout_name, "wb+");
    if (fout == NULL)
    {
        return 1;
    }

    for (int i = 0; i < (BIN_FILE_SIZE / sizeof(buf)); i++)
    {
        if (i % 2 == 0)
        {
            memset(buf, 0xa5, sizeof(buf));
        }
        else
        {
            memset(buf, 0x5a, sizeof(buf));
        }

        fwrite(buf, 1, sizeof(buf), fout);
    }

    printf("%s(%dBytes) \n", fout_name, BIN_FILE_SIZE / 1024);
    return 0;
}